package com.campus.common.exception;


import com.campus.entity.ResultBody;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * 全部异常处理
 *
 * @author Alaskaboo
 * @time 2022-10-23 14:42:37
 */
@Slf4j
@RestControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(value = RuntimeException.class)
    public ResultBody handler(RuntimeException e) {
        log.error("运行时异常：---------" + e.getMessage());
        return ResultBody.error().message(e.getMessage());
    }
}
